package org.example.game.entity;

import java.awt.*;

public abstract class GameObject {
    protected int x;
    protected int y;
    protected int width;
    protected int height;
    protected Rectangle bounds;

    public GameObject(int x, int y, int width, int height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
        this.bounds = new Rectangle(x, y, width, height);
    }

    public abstract void draw(Graphics g);

    public Rectangle getBounds() {
        bounds.setLocation(x, y);
        return bounds;
    }

    public boolean intersects(GameObject other) {
        return getBounds().intersects(other.getBounds());
    }

    public int getX() {
        return x;
    }

    public int getY() {
        return y;
    }

    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }
} 